package com.yy.controller;

import com.yy.mapper.MeetMapper;
import com.yy.pojo.Meet;
import com.yy.service.MeetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: yy
 * @Date
 */
@RestController
public class MeetController {
    @Autowired
     MeetService meetService;


    /**
     * 添加一个会议
     */
    @PostMapping("/addMeet")
    public int addMeet(@RequestBody Meet meet){
        return meetService.addMeet(meet);
    }

//    @GetMapping  ("/addMeet")
//    public String addMeet(){
//        Meet meet = new Meet("ewf","fesf","fef","ger","greg","greg","hth","htrh");
//        meetService.addMeet(meet);
//        return "ok";
//    }



    /**
     * 查看会议
     */
    @GetMapping("/getMeetList")
    public List<Meet> getMeetList(){
        List<Meet> meetList = meetService.getMeetList();
        for (Meet meet : meetList){
            System.out.println(meet);
        }
        return meetList;
    }

    @DeleteMapping("/deleteMeet/{mId}")
    public int deleteMeet(@PathVariable("mId") String mId){
        return meetService.deleteMeet(mId);
    }

}
